<?php
session_start();
include_once( 'config.php' );

preg_match("/(?<=#)([^#]+)(?=#)/i", $_POST['status'], $matches);
$url = WEBSITE_URL."followTrend.php?";
foreach($matches as $trend) { 
	$url = $url."&trend=".$trend;
}
$weibo4php = $_SESSION['weibo4php']; 
$shorturl = $weibo4php->shorturl($url);
$all = $_POST['status']." ".$shorturl;
if(count($all) > 140){
	echo json_encode("内容有点长。>_<");
}

$weibo4php->UpdateStatus($all);
foreach($matches as $trend) { 
	if (!$weibo4php->isTrendFollowed($trend)) {
		$weibo4php->trendsFollow($trend);
	}
}
echo json_encode(null);
?>

